package com.csg.ses.common.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * mybatis 工具类
 * @auther wangjun
 * @date 2020/11/16
 */
public class MybatisPlusUtil {

    /**
     * 初始化分页参数
     * @param current
     * @param size
     * @return
     */
    public static Page initPage(Long current, Long size, Boolean isSearchCount) {
        current = (current != null && current > 0) ? current : 1;   //当前页
        size = (size != null && size > 0) ? size : 5;  //每页记录数（默认10条）
        isSearchCount = isSearchCount != null ? isSearchCount : true;   //是否查询总记录数
        return new Page(current, size, isSearchCount);
    }
}